home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / TESTING / MEM1.PAS < prev    next >
Pascal/Delphi Source File  |  1996-07-21  |  960b  |  36 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Testing; memory allocations via AllocationObjectType
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBMEM;
  10.  
  11. var Data1, Data2 : AllocationObjectType;
  12.     String1, String2 : string;
  13.  
  14.  
  15. begin
  16.      String1 := 'This';
  17.      String2 := 'Nothing';
  18.  
  19.      with Data1 do begin
  20.           Initialize (SizeOf(String1));
  21.           MoveIn (@String1, SizeOf(String1), 0);
  22.  
  23.           { Duplicate allocation }
  24.           Data2.InitializeEmpty;
  25.           Duplicate (@Data2);
  26.  
  27.           Intercept;
  28.      end;
  29.  
  30.      with Data2 do begin
  31.           MoveOut (@String2, DataSize, 0);
  32.           Intercept;
  33.      end;
  34.  
  35.      WriteLn ('"', String2, '" should be equal to "', String1, '".');
  36. end.